package btcbot.entities;

import net.sf.json.JSONObject;

/**
 * TODO Comment
 *
 * @author mollagnier
 */
public class DepthEntry {

    private Double price;
    private Double amount;
    private Integer stamp;

    public DepthEntry(JSONObject jsonDepthEntry) {
        super();
        this.price = jsonDepthEntry.getDouble("price");
        this.amount = jsonDepthEntry.getDouble("amount");
        this.stamp = jsonDepthEntry.getInt("stamp");
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Integer getStamp() {
        return stamp;
    }

    public void setStamp(Integer stamp) {
        this.stamp = stamp;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((amount == null) ? 0 : amount.hashCode());
        result = prime * result + ((price == null) ? 0 : price.hashCode());
        result = prime * result + ((stamp == null) ? 0 : stamp.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        DepthEntry other = (DepthEntry) obj;
        if (amount == null) {
            if (other.amount != null)
                return false;
        }
        else if (!amount.equals(other.amount))
            return false;
        if (price == null) {
            if (other.price != null)
                return false;
        }
        else if (!price.equals(other.price))
            return false;
        if (stamp == null) {
            if (other.stamp != null)
                return false;
        }
        else if (!stamp.equals(other.stamp))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "DepthEntry [price=" + price + ", amount=" + amount + ", stamp=" + stamp + "]";
    }

}